/******************************************************************************
 * The contents of this file are subject to the   JDI License  Version 1.0
 * ("License"); You may not use this file except in compliance with the License
 * Software distributed under the License is distributed on an  "AS IS"  basis,
 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
 * the specific language governing rights and limitations under the License.
 * The Initial Developer of the Original Code is 陈慧然. Portions created by 
 * 陈慧然 are Copyright 陈慧然.
 * All Rights Reserved.
 *
 *              Contact john_holen@163.com for licensing alternatives.
 *
 *****************************************************************************/


package org.peony.baseinfo;
import org.peony.exceptions.*;
/**
 *  
 *
 *  @author     陈慧然
 *  @version    Id: Sysinfo.java, v 0.000 2007-12-30 15:56:39 陈慧然 Exp
 */
public final class Sysinfo{
	
	//Java 运行时环境规范版本，必须为“1.5”以上
	private String jdkV;
	//Java 虚拟机实现版本
	private String jvmV;
	//应用系统提供商
	private String appP;
	//应用系统名称
	private String appN;
	//操作系统名称
	private String osN;
	
	private Sysinfo(){
		super();
		this.jdkV = System.getProperty("java.specification.version");
		this.jvmV = System.getProperty("java.vm.version");
		this.appP = "JDI Info Sys";
		this.appN = "JDI";
		this.osN =  System.getProperty("os.name");
	}
	/**
	 * cTcs表示用户采用C/S架构。
	 */
	public final static byte cTcs = 1;
	/**
	 * cTbs表示用户采用B/S架构。
	 */
	public final static byte cTbs = 2;
	/**
	 * cTall表示用户同时采用C/S和B/S架构。
	 */
	public final static byte cTall = 3;
	/**
	 * ct记录用户采用的系统架构：C/S B/S 或两者同时使用。
	 */
	public int ct;
	
	//数据库名称。
	private String dbN;
	//数据库驱动。
	private String dbD;
	//数据库端口。
	private String dbP;
	
	/**
	 * lg,用户使用的语言。
	 */
	public int lg;
	/**
	 * sn,用户被授权的序列号
	 */
	public java.util.Hashtable sn = new java.util.Hashtable();
	
	public String getAppN() {
		return appN;
	}
	public void setAppN(String appN) {
		if(appN == null || appN.equals("")){
			setAppN();
		}else
		this.appN = appN;
	}
	public void setAppN(){
		this.appN = "JDI";
	}
	public String getAppP() {
		return appP;
	}
	public void setAppP(String appP) {
		if(appP == null || appP.equals(""))
			setAppP();
		else
		this.appP = appP;
	}
	public void setAppP(){
		this.appP = "JDI Group, Leader is 陈慧然";
	}
	public int getCt() {
		return ct;
	}
	public void setCt(int ct) {
			switch (ct){
			case Sysinfo.cTall:
				this.ct = Sysinfo.cTall;
			case Sysinfo.cTbs:
				this.ct = Sysinfo.cTbs;
			case Sysinfo.cTcs:
				this.ct = Sysinfo.cTcs;
			default:
				throw new SysinfoException(SysinfoException.ct);
			}
	}
	public String getDbD() {
		return dbD;
	}
	public void setDbD(String dbD) {
		this.dbD = dbD;
	}
	public String getDbN() {
		return dbN;
	}
	public void setDbN(String dbN) {
		this.dbN = dbN;
	}
	public String getDbP() {
		return dbP;
	}
	public void setDbP(String dbP) {
		this.dbP = dbP;
	}
	public String getJdkV() {
		return jdkV;
	}
	public void setJdkV(String jdkV) {
		this.jdkV = jdkV;
	}
	public String getJvmV() {
		return jvmV;
	}
	public void setJvmV(String jvmV) {
		this.jvmV = jvmV;
	}
	public int getLg() {
		return lg;
	}
	public void setLg(int lg) {
		this.lg = lg;
	}
	public String getOsN() {
		return osN;
	}
	public void setOsN(String osN) {
		this.osN = osN;
	}
	public java.util.Hashtable getSn() {
		return sn;
	}
	public void setSn(java.util.Hashtable sn) {
		this.sn = sn;
	}
}
